package org.zfes.snowier.cloud.zbss.cms.router.service.topic;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.topic.model.CmsTopicColumn;
import org.zfes.snowier.cloud.zbss.cms.topic.service.ICmsTopicColumnService;
@Controller 
@RequestMapping("/cms/topic/cmsTopicColumn")
public class CmsTopicColumnController extends BaseController {

	
	@Autowired
	private ICmsTopicColumnService cmsTopicColumnService;
	
	@RequiresPermissions(value="cmsTopicColumn:loadCmsTopicColumnDataSet",desc="专题栏目列表")
    @RequestMapping(value="/loadCmsTopicColumnDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicColumnDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsTopicColumnService.loadCmsTopicColumnDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsTopicColumn:createCmsTopicColumn",desc="专题栏目添加")
    @RequestMapping(value="/createCmsTopicColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsTopicColumn(CmsTopicColumn cmsTopicColumn){
		cmsTopicColumnService.createCmsTopicColumn(cmsTopicColumn);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicColumn:loadCmsTopicColumn",desc="专题栏目加载")
    @RequestMapping(value="/loadCmsTopicColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsTopicColumn(Long id){
		Optional<CmsTopicColumn> ops = cmsTopicColumnService.loadCmsTopicColumnById(id);
		return ajaxQuery("cmsTopicColumn",ops);
    }
	
	@RequiresPermissions(value="cmsTopicColumn:updateCmsTopicColumn",desc="专题栏目更新")
    @RequestMapping(value="/updateCmsTopicColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsTopicColumn(CmsTopicColumn cmsTopicColumn){
		cmsTopicColumnService.updateCmsTopicColumn(cmsTopicColumn);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsTopicColumn:deletCmsTopicColumn",desc="专题栏目删除")
    @RequestMapping(value="/deleteCmsTopicColumn", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsTopicColumn(Long id){
		cmsTopicColumnService.deleteCmsTopicColumn(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}